/**
 *******************************************************************************
 * @FileName  : main.c
 * @Author    : GaoQiu
 * @CreateDate: 2020-05-18
 * @Copyright : Copyright(C) GaoQiu
 *              All Rights Reserved.
 *******************************************************************************
 *
 * The information contained herein is confidential and proprietary property of
 * GaoQiu and is available under the terms of Commercial License Agreement
 * between GaoQiu and the licensee in separate contract or the terms described
 * here-in.
 *
 * This heading MUST NOT be removed from this file.
 *
 * Licensees are granted free, non-transferable use of the information in this
 * file under Mutual Non-Disclosure Agreement. NO WARRENTY of ANY KIND is provided.
 *
 *******************************************************************************
 */
#include "user_main.h"
#include "app_config.h"
#include "stack/controller/ll_api.h"
#include "hci_transport/hci_tr_api.h"
#include "component/usb/usb_api.h"


RAM_CODE void irq_handler(void)
{
	/* BLE IRQ. */
	BLE_IRQHandler();

	HCI_TR_IRQHandler();
}

int main(void)
{
	/* System Initialization. */
	SystemInit();

	/* GPIO define Initialization. */
	GPIO_DefInit();

	/* System clock config. */
	RCC_SetFhs(FHS_SRC_48M);                /*!< Set FHS clock to 48M.    */
	//RCC_SetSysClk(SYS_CLK_SRC_32M_XTAL, 0); /*!< Set System clock to 32M. */
	RCC_SetSysClk(SYS_CLK_SRC_FHS, 0);     /*!< Set System clock to 48M. */

	/* Track Initialization. */
	TrackSystemInit();

	/* setup */
	Setup();

	/* Enable global interrupt. */
	IRQ_Enable();

	/* Print System Info */
	TrackPrintSystemInfo();

	for(;;)
	{
		Loop();

		TRACK_START();
	}
	return 0;
}
